package thread_test;

// 测试 start() 方法与 run() 方法的区别
public class ThreadDemo8 {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            while (true) {
                System.out.println("hello thread!");
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    // e.printStackTrace();
                    throw new RuntimeException(e);
                }
            }
        });
        t.run();
        while (true) {
            System.out.println("hello main!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
